home *** CD-ROM | disk | FTP | other *** search
- Path: uunet!snorkelwacker!apple!sun-barr!newstop!sun!decpa.pa.dec.com
- From: dbs@decpa.pa.dec.com (dan sears)
- Newsgroups: comp.sources.x
- Subject: v07i054: xtiff, Patch1, Part01/01
- Message-ID: <135893@sun.Eng.Sun.COM>
- Date: 17 May 90 20:44:27 GMT
- Sender: news@sun.Eng.Sun.COM
- Lines: 712
- Approved: argv@sun.com
-
- Submitted-by: dbs@decpa.pa.dec.com (dan sears)
- Posting-number: Volume 7, Issue 54
- Archive-name: xtiff/patch1
- Patch-To: xtiff: Volume 7, Issue 37 (5/12/90)
-
- These patches correct a few minor bugs in the original release of xtiff
- dealing with different visual types. The routines CreateXImage() and
- GetTIFFImage() are where these problems reside and are resolved. Basically,
- the available documentation does not provide enough information to figure
- out the many to many mapping between a complex TIFF image and the numerous
- configurations of X visuals. We would like to write some magic code in
- CreateXImage which worked for all cases on all servers but it isn't that
- simple.
-
- NB: xtiff.c requires libtiff version 2.2, which is currently in beta test.
- --Dan Sears
-
-
- -- cut here (patch.01) --
- diff -r -c rev1/Imakefile rev2/Imakefile
- *** rev1/Imakefile Wed May 16 12:33:35 1990
- --- rev2/Imakefile Thu May 17 11:18:37 1990
- ***************
- *** 17,28 ****
- AllTarget(xtiff)
- NormalProgramTarget(xtiff, $(OBJS), /* */, $(LOCAL_LIBRARIES), /* */)
- DependTarget()
- -
- - proto::
- - cproto $(TIFF_INCLUDES) xtiff.c > xtiff.proto
- -
- - lint::
- - lint $(TIFF_INCLUDES) xtiff.c -lX11 -lm
- -
- - tags::
- - ctags xtiff.c
- --- 17,19 ----
- diff -r -c /dev/null rev2/patchlevel.h
- *** /dev/null Wed May 16 23:18:29 1990
- --- patchlevel.h Thu May 17 11:16:26 1990
- ***************
- *** 0 ****
- --- 1 ----
- + #define PATCHLEVEL 1
- diff -r -c rev1/xtiff.c rev2/xtiff.c
- *** rev1/xtiff.c Wed May 16 12:33:38 1990
- --- rev2/xtiff.c Thu May 17 11:21:23 1990
- ***************
- *** 1,9 ****
- /*
- * xtiff - view a TIFF file in an X window
- *
- ! * Dan Sears - May 7, 1990
- * Chris Sears
- *
- * Copyright 1990 by Digital Equipment Corporation, Maynard, Massachusetts.
- *
- * All Rights Reserved
- --- 1,14 ----
- /*
- * xtiff - view a TIFF file in an X window
- *
- ! * Dan Sears
- * Chris Sears
- *
- + * Revsion 1.1 90/05/16
- + * Fixed a few minor bugs.
- + * Revsion 1.0 90/05/07
- + * Initial release.
- + *
- * Copyright 1990 by Digital Equipment Corporation, Maynard, Massachusetts.
- *
- * All Rights Reserved
- ***************
- *** 42,49 ****
- * default TIFF and X orientation. Other orientations will be
- * displayed incorrectly.
- *
- ! * Only TIFFTAG_BITSPERSAMPLE values that are powers of 2 (1, 2, 4 or 8)
- ! * are supported.
- */
-
- #include <math.h>
- --- 47,56 ----
- * default TIFF and X orientation. Other orientations will be
- * displayed incorrectly.
- *
- ! * There is no support for or use of 3/3/2 DirectColor visuals.
- ! * TIFFTAG_MINSAMPLEVALUE and TIFFTAG_MAXSAMPLEVALUE are not supported.
- ! *
- ! * Only TIFFTAG_BITSPERSAMPLE values that are 1, 2, 4 or 8 are supported.
- */
-
- #include <math.h>
- ***************
- *** 82,88 ****
- GC xWinGc, xBitmapGc;
- XGCValues xGcValues;
- int xScreen, xSyncFlag = False, xImageDepth, xNVisuals,
- ! xPixmapFlag = True;
- char * xGeometry = NULL, *xDisplayName = NULL;
- XVisualInfo * xVisualList;
-
- --- 89,95 ----
- GC xWinGc, xBitmapGc;
- XGCValues xGcValues;
- int xScreen, xSyncFlag = False, xImageDepth, xNVisuals,
- ! xPixmapFlag = True, xRedMask, xGreenMask, xBlueMask;
- char * xGeometry = NULL, *xDisplayName = NULL;
- XVisualInfo * xVisualList;
-
- ***************
- *** 92,99 ****
- TIFF * tfFile;
- u_short tfBitsPerSample, tfSamplesPerPixel, tfPlanarConfiguration,
- tfPhotometricInterpretation, tfGrayResponseUnit,
- ! tfImageDepth, tfImageWidth, tfImageHeight, tfBytesPerRow,
- ! tfFillOrder;
- int tfDirectory = 0;
- double tfUnitMap, tfGrayResponseUnitMap[] = {
- -1, -10, -100, -1000, -10000, -100000
- --- 99,105 ----
- TIFF * tfFile;
- u_short tfBitsPerSample, tfSamplesPerPixel, tfPlanarConfiguration,
- tfPhotometricInterpretation, tfGrayResponseUnit,
- ! tfImageDepth, tfImageWidth, tfImageHeight, tfBytesPerRow;
- int tfDirectory = 0;
- double tfUnitMap, tfGrayResponseUnitMap[] = {
- -1, -10, -100, -1000, -10000, -100000
- ***************
- *** 122,129 ****
- programName = argv[0];
-
- if (argc == 1) {
- ! fprintf(stderr, "Usage: %s file\n", programName);
- ! fprintf(stderr, "options:\n");
- fprintf(stderr, " [-directory directory]\n");
- fprintf(stderr, " [-display display]\n");
- fprintf(stderr, " [-gamma gamma]\n");
- --- 128,134 ----
- programName = argv[0];
-
- if (argc == 1) {
- ! fprintf(stderr, "Usage: %s file\noptions:\n", programName);
- fprintf(stderr, " [-directory directory]\n");
- fprintf(stderr, " [-display display]\n");
- fprintf(stderr, " [-gamma gamma]\n");
- ***************
- *** 182,189 ****
- /*
- * If the following tags aren't present then use the TIFF defaults.
- */
- - if (!TIFFGetField(tfFile, TIFFTAG_FILLORDER, &tfFillOrder))
- - tfFillOrder = FILLORDER_MSB2LSB;
- if (!TIFFGetField(tfFile, TIFFTAG_BITSPERSAMPLE, &tfBitsPerSample))
- tfBitsPerSample = 1;
- if (!TIFFGetField(tfFile, TIFFTAG_SAMPLESPERPIXEL, &tfSamplesPerPixel))
- --- 187,192 ----
- ***************
- *** 200,205 ****
- --- 203,209 ----
- dRed = (double *) malloc(colormapSize * sizeof(double));
- dGreen = (double *) malloc(colormapSize * sizeof(double));
- dBlue = (double *) malloc(colormapSize * sizeof(double));
- + MCHECK(dRed); MCHECK(dGreen); MCHECK(dBlue);
-
- /*
- * If TIFFTAG_PHOTOMETRIC is not present then assign a reasonable default.
- ***************
- *** 306,314 ****
- }
-
- /*
- ! * Many programs get TIFF colormaps wrong. They use 8-bit colormaps instead
- ! * of 16-bit colormaps. This function is a heuristic to detect and correct
- ! * that problem.
- */
- void
- CheckAndCorrectColormap()
- --- 310,317 ----
- }
-
- /*
- ! * Many programs get TIFF colormaps wrong. They use 8-bit colormaps instead of
- ! * 16-bit colormaps. This function is a heuristic to detect and correct this.
- */
- void
- CheckAndCorrectColormap()
- ***************
- *** 334,348 ****
- register int i;
-
- for (i = 0; i < colormapSize; i++) {
- ! if ((tfPhotometricInterpretation == PHOTOMETRIC_MINISWHITE)
- && (i == colormapSize - 1))
- redMap[i] = greenMap[i] = blueMap[i] = 0;
- ! else if (i == 0)
- ! redMap[i] = greenMap[i] = blueMap[i] = 0;
- !
- ! redMap[i] = ROUND((pow(dRed[i] / 65535.0, 1.0 / dGamma) * 65535.0));
- ! greenMap[i] = ROUND((pow(dGreen[i] / 65535.0, 1.0 / dGamma) * 65535.0));
- ! blueMap[i] = ROUND((pow(dBlue[i] / 65535.0, 1.0 / dGamma) * 65535.0));
- }
-
- free(dRed); free(dGreen); free(dBlue);
- --- 337,352 ----
- register int i;
-
- for (i = 0; i < colormapSize; i++) {
- ! if (((tfPhotometricInterpretation == PHOTOMETRIC_MINISWHITE)
- && (i == colormapSize - 1))
- + || ((tfPhotometricInterpretation == PHOTOMETRIC_MINISBLACK)
- + && (i == 0)))
- redMap[i] = greenMap[i] = blueMap[i] = 0;
- ! else {
- ! redMap[i] = ROUND((pow(dRed[i] / 65535.0, 1.0 / dGamma) * 65535.0));
- ! greenMap[i] = ROUND((pow(dGreen[i] / 65535.0, 1.0 / dGamma) * 65535.0));
- ! blueMap[i] = ROUND((pow(dBlue[i] / 65535.0, 1.0 / dGamma) * 65535.0));
- ! }
- }
-
- free(dRed); free(dGreen); free(dBlue);
- ***************
- *** 355,361 ****
- char **xargv;
- {
- register int i;
- ! int win_x = 0, win_y = 0, win_width, win_height;
- u_int border_width = 3;
- XSizeHints size_hints;
- XSetWindowAttributes window_attributes;
- --- 359,365 ----
- char **xargv;
- {
- register int i;
- ! int win_x = 0, win_y = 0, win_w = tfImageWidth, win_h = tfImageHeight;
- u_int border_width = 3;
- XSizeHints size_hints;
- XSetWindowAttributes window_attributes;
- ***************
- *** 368,376 ****
- exit(0);
- }
-
- - xScreen = DefaultScreen(xDisplay);
- XSetErrorHandler(XTiffErrorHandler);
- XSynchronize(xDisplay, xSyncFlag);
-
- if (tfImageDepth != 1) {
- template_visual.screen = xScreen;
- --- 372,380 ----
- exit(0);
- }
-
- XSetErrorHandler(XTiffErrorHandler);
- XSynchronize(xDisplay, xSyncFlag);
- + xScreen = DefaultScreen(xDisplay);
-
- if (tfImageDepth != 1) {
- template_visual.screen = xScreen;
- ***************
- *** 386,392 ****
- switch (tfImageDepth) {
- /*
- * X really wants a 32-bit image with the fourth channel unused,
- ! * but the visual structure thinks it's 24-bit.
- */
- case 32:
- case 24:
- --- 390,396 ----
- switch (tfImageDepth) {
- /*
- * X really wants a 32-bit image with the fourth channel unused,
- ! * but the visual structure thinks it's 24-bit. bitmap_unit is 32.
- */
- case 32:
- case 24:
- ***************
- *** 397,402 ****
- --- 401,407 ----
- }
-
- colors = (XColor *) malloc(3 * colormapSize * sizeof(XColor));
- + MCHECK(colors);
-
- for (i = 0; i < colormapSize; i++) {
- colors[i].pixel = (u_long) (i << 16) + (i << 8) + i;
- ***************
- *** 420,431 ****
- switch (tfPhotometricInterpretation) {
- case PHOTOMETRIC_MINISWHITE:
- case PHOTOMETRIC_MINISBLACK:
- - /*
- - * The VAX Firefox is broken here so PseudoColor is searched first.
- - * The GrayScale visual doesn't seem to work.
- - */
- - if (SearchVisualList((int) tfImageDepth, PseudoColor, &xVisual))
- - break;
- if (SearchVisualList((int) tfImageDepth, GrayScale, &xVisual))
- break;
- case PHOTOMETRIC_PALETTE:
- --- 425,430 ----
- ***************
- *** 438,443 ****
- --- 437,443 ----
- }
-
- colors = (XColor *) malloc(colormapSize * sizeof(XColor));
- + MCHECK(colors);
-
- for (i = 0; i < colormapSize; i++) {
- colors[i].pixel = (u_long) i;
- ***************
- *** 450,456 ****
- /*
- * xtiff's colormap allocation is private. It does not attempt
- * to detect whether any existing colormap entries are suitable
- ! * for its use.
- */
- xColormap = XCreateColormap(xDisplay, RootWindow(xDisplay, xScreen),
- xVisual, AllocAll);
- --- 450,456 ----
- /*
- * xtiff's colormap allocation is private. It does not attempt
- * to detect whether any existing colormap entries are suitable
- ! * for its use. This causes colormap flashing.
- */
- xColormap = XCreateColormap(xDisplay, RootWindow(xDisplay, xScreen),
- xVisual, AllocAll);
- ***************
- *** 473,481 ****
- window_attributes.event_mask = ExposureMask | ButtonPressMask;
-
- /*
- ! * win_width and win_height are not currently used.
- */
- ! XParseGeometry(xGeometry, &win_x, &win_y, &win_width, &win_height);
-
- xWindow = XCreateWindow(xDisplay, RootWindow(xDisplay, xScreen),
- win_x, win_y, tfImageWidth, tfImageHeight, border_width,
- --- 473,482 ----
- window_attributes.event_mask = ExposureMask | ButtonPressMask;
-
- /*
- ! * win_w and win_h are not currently used.
- */
- ! if (xGeometry != NULL)
- ! XParseGeometry(xGeometry, &win_x, &win_y, &win_w, &win_h);
-
- xWindow = XCreateWindow(xDisplay, RootWindow(xDisplay, xScreen),
- win_x, win_y, tfImageWidth, tfImageHeight, border_width,
- ***************
- *** 495,508 ****
- xtifficon_bits, xtifficon_width, xtifficon_height);
-
- size_hints.flags = PPosition | PSize | PMinSize | PMaxSize;
- ! size_hints.x = win_x;
- ! size_hints.y = win_y;
- ! size_hints.width = tfImageWidth;
- ! size_hints.height = tfImageHeight;
- ! size_hints.min_width = tfImageWidth;
- ! size_hints.min_height = tfImageHeight;
- ! size_hints.max_width = tfImageWidth;
- ! size_hints.max_height = tfImageHeight;
-
- XSetStandardProperties(xDisplay, xWindow, programName, programName,
- xTiffIconPixmap, xargv, xargc, &size_hints);
- --- 496,506 ----
- xtifficon_bits, xtifficon_width, xtifficon_height);
-
- size_hints.flags = PPosition | PSize | PMinSize | PMaxSize;
- ! size_hints.x = win_x; size_hints.y = win_y;
- ! size_hints.width = size_hints.min_width =
- ! size_hints.max_width = tfImageWidth;
- ! size_hints.height = size_hints.min_height =
- ! size_hints.max_height = tfImageHeight;
-
- XSetStandardProperties(xDisplay, xWindow, programName, programName,
- xTiffIconPixmap, xargv, xargc, &size_hints);
- ***************
- *** 523,530 ****
-
- for (vis = xVisualList, i = 0; i < xNVisuals; vis++, i++) {
- if ((vis->class == visual_class) && (vis->depth >= image_depth)) {
- xImageDepth = vis->depth;
- ! xVisual = vis->visual;
- return True;
- }
- }
- --- 521,531 ----
-
- for (vis = xVisualList, i = 0; i < xNVisuals; vis++, i++) {
- if ((vis->class == visual_class) && (vis->depth >= image_depth)) {
- + *visual = vis->visual;
- xImageDepth = vis->depth;
- ! xRedMask = vis->red_mask;
- ! xGreenMask = vis->green_mask;
- ! xBlueMask = vis->blue_mask;
- return True;
- }
- }
- ***************
- *** 535,542 ****
- void
- GetTIFFImage()
- {
- register int i, j, s;
- ! register u_char *scan_line, *output_p, *input_p, p;
-
- tfBytesPerRow = TIFFScanlineSize(tfFile);
- scan_line = (u_char *) malloc(tfBytesPerRow);
- --- 536,544 ----
- void
- GetTIFFImage()
- {
- + register u_char *scan_line, *output_p, *input_p;
- register int i, j, s;
- ! int pixel_map[3], red_shift, green_shift, blue_shift;
-
- tfBytesPerRow = TIFFScanlineSize(tfFile);
- scan_line = (u_char *) malloc(tfBytesPerRow);
- ***************
- *** 543,561 ****
- MCHECK(scan_line);
-
- if ((tfImageDepth == 32) || (tfImageDepth == 24)) {
- ! output_p = imageMemory =
- ! (u_char *) malloc(tfImageWidth * tfImageHeight * 4);
- MCHECK(imageMemory);
-
- if (tfPlanarConfiguration == PLANARCONFIG_CONTIG) {
- for (i = 0; i < tfImageHeight; i++) {
- if (TIFFReadScanline(tfFile, scan_line, i, 0) < 0)
- break;
- for (input_p = scan_line, j = 0; j < tfImageWidth; j++) {
- ! *output_p++ = *input_p++;
- ! *output_p++ = *input_p++;
- ! *output_p++ = *input_p++;
- ! output_p++;
- if (tfSamplesPerPixel == 4) /* skip the fourth channel */
- input_p++;
- }
- --- 545,573 ----
- MCHECK(scan_line);
-
- if ((tfImageDepth == 32) || (tfImageDepth == 24)) {
- ! output_p = imageMemory = (u_char *)
- ! malloc(tfImageWidth * tfImageHeight * 4);
- MCHECK(imageMemory);
-
- + /*
- + * Handle different color masks for different frame buffers.
- + */
- + red_shift = pixel_map[0] = xRedMask == 0xFF000000 ? 3
- + : (xRedMask == 0xFF0000 ? 2 : (xRedMask == 0xFF00 ? 1 : 0));
- + green_shift = pixel_map[1] = xGreenMask == 0xFF000000 ? 3
- + : (xGreenMask == 0xFF0000 ? 2 : (xGreenMask == 0xFF00 ? 1 : 0));
- + blue_shift = pixel_map[2] = xBlueMask == 0xFF000000 ? 3
- + : (xBlueMask == 0xFF0000 ? 2 : (xBlueMask == 0xFF00 ? 1 : 0));
- +
- if (tfPlanarConfiguration == PLANARCONFIG_CONTIG) {
- for (i = 0; i < tfImageHeight; i++) {
- if (TIFFReadScanline(tfFile, scan_line, i, 0) < 0)
- break;
- for (input_p = scan_line, j = 0; j < tfImageWidth; j++) {
- ! *(output_p + red_shift) = *input_p++;
- ! *(output_p + green_shift) = *input_p++;
- ! *(output_p + blue_shift) = *input_p++;
- ! output_p += 4;
- if (tfSamplesPerPixel == 4) /* skip the fourth channel */
- input_p++;
- }
- ***************
- *** 568,574 ****
- if (TIFFReadScanline(tfFile, scan_line, i, s) < 0)
- break;
- input_p = scan_line;
- ! output_p = imageMemory + (i * tfImageWidth * 4) + s;
- for (j = 0; j < tfImageWidth; j++, output_p += 4)
- *output_p = *input_p++;
- }
- --- 580,586 ----
- if (TIFFReadScanline(tfFile, scan_line, i, s) < 0)
- break;
- input_p = scan_line;
- ! output_p = imageMemory + (i*tfImageWidth*4) + pixel_map[s];
- for (j = 0; j < tfImageWidth; j++, output_p += 4)
- *output_p = *input_p++;
- }
- ***************
- *** 581,588 ****
- */
- if ((tfPhotometricInterpretation == PHOTOMETRIC_MINISWHITE)
- && (tfImageDepth == 1)) {
- ! output_p = imageMemory =
- ! (u_char *) malloc(tfBytesPerRow * tfImageHeight);
- MCHECK(imageMemory);
-
- for (i = 0; i < tfImageHeight; i++, output_p += tfBytesPerRow) {
- --- 593,600 ----
- */
- if ((tfPhotometricInterpretation == PHOTOMETRIC_MINISWHITE)
- && (tfImageDepth == 1)) {
- ! output_p = imageMemory = (u_char *)
- ! malloc(tfBytesPerRow * tfImageHeight);
- MCHECK(imageMemory);
-
- for (i = 0; i < tfImageHeight; i++, output_p += tfBytesPerRow) {
- ***************
- *** 593,600 ****
- *input_p = ~ *input_p;
- }
- } else if (xImageDepth == tfImageDepth) {
- ! output_p = imageMemory =
- ! (u_char *) malloc(tfBytesPerRow * tfImageHeight);
- MCHECK(imageMemory);
-
- for (i = 0; i < tfImageHeight; i++, output_p += tfBytesPerRow)
- --- 605,612 ----
- *input_p = ~ *input_p;
- }
- } else if (xImageDepth == tfImageDepth) {
- ! output_p = imageMemory = (u_char *)
- ! malloc(tfBytesPerRow * tfImageHeight);
- MCHECK(imageMemory);
-
- for (i = 0; i < tfImageHeight; i++, output_p += tfBytesPerRow)
- ***************
- *** 601,608 ****
- if (TIFFReadScanline(tfFile, output_p, i, 0) < 0)
- break;
- } else if ((xImageDepth == 8) && (tfImageDepth == 4)) {
- ! output_p = imageMemory =
- ! (u_char *) malloc(tfBytesPerRow * 2 * tfImageHeight + 2);
- MCHECK(imageMemory);
-
- /*
- --- 613,620 ----
- if (TIFFReadScanline(tfFile, output_p, i, 0) < 0)
- break;
- } else if ((xImageDepth == 8) && (tfImageDepth == 4)) {
- ! output_p = imageMemory = (u_char *)
- ! malloc(tfBytesPerRow * 2 * tfImageHeight + 2);
- MCHECK(imageMemory);
-
- /*
- ***************
- *** 616,628 ****
- output_p = &imageMemory[i * tfImageWidth];
- input_p = scan_line;
- for (j = 0; j < tfImageWidth; j += 2, input_p++) {
- ! *output_p++ = (*input_p) >> 4;
- ! *output_p++ = (*input_p) & 0xf;
- }
- }
- } else if ((xImageDepth == 8) && (tfImageDepth == 2)) {
- ! output_p = imageMemory =
- ! (u_char *) malloc(tfBytesPerRow * 4 * tfImageHeight + 4);
- MCHECK(imageMemory);
-
- for (i = 0; i < tfImageHeight; i++) {
- --- 628,640 ----
- output_p = &imageMemory[i * tfImageWidth];
- input_p = scan_line;
- for (j = 0; j < tfImageWidth; j += 2, input_p++) {
- ! *output_p++ = *input_p >> 4;
- ! *output_p++ = *input_p & 0xf;
- }
- }
- } else if ((xImageDepth == 8) && (tfImageDepth == 2)) {
- ! output_p = imageMemory = (u_char *)
- ! malloc(tfBytesPerRow * 4 * tfImageHeight + 4);
- MCHECK(imageMemory);
-
- for (i = 0; i < tfImageHeight; i++) {
- ***************
- *** 638,645 ****
- }
- }
- } else if ((xImageDepth == 4) && (tfImageDepth == 2)) {
- ! output_p = imageMemory =
- ! (u_char *) malloc(tfBytesPerRow * 2 * tfImageHeight + 2);
- MCHECK(imageMemory);
-
- for (i = 0; i < tfImageHeight; i++) {
- --- 650,657 ----
- }
- }
- } else if ((xImageDepth == 4) && (tfImageDepth == 2)) {
- ! output_p = imageMemory = (u_char *)
- ! malloc(tfBytesPerRow * 2 * tfImageHeight + 2);
- MCHECK(imageMemory);
-
- for (i = 0; i < tfImageHeight; i++) {
- ***************
- *** 648,655 ****
- output_p = &imageMemory[i * tfImageWidth];
- input_p = scan_line;
- for (j = 0; j < tfImageWidth; j += 4, input_p++) {
- ! *output_p++ = ((*input_p >> 6) << 4) | (*input_p >> 4) & 3;
- ! *output_p++ = (((*input_p >> 2) & 3) << 4) | *input_p & 3;
- }
- }
- } else {
- --- 660,667 ----
- output_p = &imageMemory[i * tfImageWidth];
- input_p = scan_line;
- for (j = 0; j < tfImageWidth; j += 4, input_p++) {
- ! *output_p++ = ((*input_p>>6) << 4) | ((*input_p >> 4) & 3);
- ! *output_p++ = (((*input_p>>2) & 3) << 4) | (*input_p & 3);
- }
- }
- } else {
- ***************
- *** 677,704 ****
- /*
- * libtiff converts LSB data into MSB but doesn't change the FillOrder tag.
- */
- ! xImage->bitmap_bit_order = MSBFirst;
- !
- if (xImageDepth <= 8)
- xImage->byte_order = MSBFirst;
- - else
- - xImage->byte_order = xVisual->red_mask > xVisual->blue_mask
- - ? LSBFirst : MSBFirst;
-
- - /*
- - * According to the O'Reilly X Protocol Reference Manual, page 53,
- - * "A pixmap depth of one is always supported and listed, but windows
- - * of depth one might not be supported." Therefore we create a pixmap
- - * of depth one and use XCopyPlane().
- - */
- if (xPixmapFlag == True) {
- xImagePixmap = XCreatePixmap(xDisplay, RootWindow(xDisplay, xScreen),
- xImage->width, xImage->height, xImageDepth);
-
- if (xImageDepth == 1) {
- ! xBitmapGc = XCreateGC(xDisplay, xImagePixmap,
- ! GCFunction | GCPlaneMask | GCForeground | GCBackground,
- ! &xGcValues);
- XPutImage(xDisplay, xImagePixmap, xBitmapGc, xImage,
- 0, 0, 0, 0, xImage->width, xImage->height);
- } else
- --- 689,712 ----
- /*
- * libtiff converts LSB data into MSB but doesn't change the FillOrder tag.
- */
- ! if (xImageDepth == 1)
- ! xImage->bitmap_bit_order = MSBFirst;
- if (xImageDepth <= 8)
- xImage->byte_order = MSBFirst;
-
- if (xPixmapFlag == True) {
- xImagePixmap = XCreatePixmap(xDisplay, RootWindow(xDisplay, xScreen),
- xImage->width, xImage->height, xImageDepth);
-
- + /*
- + * According to the O'Reilly X Protocol Reference Manual, page 53,
- + * "A pixmap depth of one is always supported and listed, but windows
- + * of depth one might not be supported." Therefore we create a pixmap
- + * of depth one and use XCopyPlane(). This is idiomatic.
- + */
- if (xImageDepth == 1) {
- ! xBitmapGc = XCreateGC(xDisplay, xImagePixmap, GCFunction
- ! | GCPlaneMask | GCForeground | GCBackground, &xGcValues);
- XPutImage(xDisplay, xImagePixmap, xBitmapGc, xImage,
- 0, 0, 0, 0, xImage->width, xImage->height);
- } else
- ***************
- *** 706,714 ****
- 0, 0, 0, 0, xImage->width, xImage->height);
- XDestroyImage(xImage);
- }
- -
- - if (xPixmapFlag == True)
- - free(imageMemory);
-
- if (grayMap != NULL)
- free(grayMap);
- --- 714,719 ----
- diff -r -c rev1/xtiff.man rev2/xtiff.man
- *** rev1/xtiff.man Wed May 16 12:33:39 1990
- --- rev2/xtiff.man Thu May 17 11:16:27 1990
- ***************
- *** 24,30 ****
- .IR file
- .SH DESCRIPTION
- .IR xtiff
- ! is a TIFF viewer for X-based on the
- .IR libtiff (3)
- package.
- It displays a single TIFF file in an X window
- --- 24,30 ----
- .IR file
- .SH DESCRIPTION
- .IR xtiff
- ! is a TIFF viewer for X based on the
- .IR libtiff (3)
- package.
- It displays a single TIFF file in an X window
- ***************
- *** 162,164 ****
- --- 162,165 ----
- or
- .IR TrueColor
- visuals except for 1-bit images.
- + There is no support for 3/3/2 DirectColor visuals.
-
- dan
- ----------------------------------------------------
- O'Reilly && Associates argv@sun.com / argv@ora.com
- Opinions expressed reflect those of the author only.
-